package com.stockz.equity.charting.display.indicator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.stockz.equity.charting.painter.indicator.LineIndicatorPainter;
import com.stockz.equity.charting.util.Constant.OVERLAY;
import com.stockz.equity.indicator.Indicator;
import com.stockz.equity.indicator.rateOfChange.RateOfChangeIndicator;
import com.stockz.equity.indicator.rateOfChange.RateOfChangeIndicatorConfiguration;
import com.stockz.equity.model.Bar.BarValueType;

@Component
public class RateOfChangeIndicatorDisplay extends AbstractDisplayableIndicatorConfiguration {

	@Autowired private RateOfChangeIndicator rateOfChangeIndicator;
	
	@Override
	public Indicator<RateOfChangeIndicatorConfiguration> getIndicator() {
		return rateOfChangeIndicator;
	}
	
	@Override
	public BarValueType getBarValueType() {
		return rateOfChangeIndicator.getBarValueType();
	}
	
	@Override
	public void setBarValueType(BarValueType barValueType) {
		rateOfChangeIndicator.setBarValueType(barValueType);
	}
	
	@Override
	public Object getConfiguration() {
		return rateOfChangeIndicator.getIndicatorConfiguration();
	}
	
	@Override
	public OVERLAY getOverlay() {
		return OVERLAY.INDEPENDENT;
	}
	
	@Override
	public String getDescription() {
		return getShortName()+","+rateOfChangeIndicator.getIndicatorConfiguration().getSpan()
		+","+rateOfChangeIndicator.getBarValueType();
	}

	@Override
	public Class<LineIndicatorPainter> getPainterClass() {
		return LineIndicatorPainter.class;
	}

	@Override
	public boolean isOverlappable() {
		return true;
	}

	@Override
	public String getFullName() {
		return "Rate Of Change";
	}

	@Override
	public String getShortName() {
		return "ROC";
	}
}
